using System.Text.Json.Serialization;

namespace LDNS.SDK.Commands.Models
{
    /// <summary>
    /// 启动服务命令
    /// 用于启动DNS服务
    /// 作者：huobing
    /// </summary>
    public sealed class StartCommand : BaseCommand<DefaultCommandResult>
    {
        public const string NAME = "START";
        public override string Name => NAME;
        public override string Format => "START";
        public override string Description => "启动DNS服务";
        public override CommandPermission Permission => CommandPermission.Admin;
        public override bool Validate(string[] args, out string error) 
        { 
            error = string.Empty; 
            return args.Length == 0 || (error = "此命令不接受参数") == string.Empty; 
        }
    }

    /// <summary>
    /// 停止服务命令
    /// 用于停止DNS服务
    /// 作者：huobing
    /// </summary>
    public sealed class StopCommand : BaseCommand<DefaultCommandResult>
    {
        public const string NAME = "STOP";
        public override string Name => NAME;
        public override string Format => "STOP";
        public override string Description => "停止DNS服务";
        public override CommandPermission Permission => CommandPermission.Admin;
        public override bool Validate(string[] args, out string error) 
        { 
            error = string.Empty; 
            return args.Length == 0 || (error = "此命令不接受参数") == string.Empty; 
        }
    }

    /// <summary>
    /// 重启服务命令
    /// 用于重启DNS服务
    /// 作者：huobing
    /// </summary>
    public sealed class RestartCommand : BaseCommand<DefaultCommandResult>
    {
        public const string NAME = "RESTART";
        public override string Name => NAME;
        public override string Format => "RESTART";
        public override string Description => "重启DNS服务";
        public override CommandPermission Permission => CommandPermission.Admin;
        public override bool Validate(string[] args, out string error) 
        { 
            error = string.Empty; 
            return args.Length == 0 || (error = "此命令不接受参数") == string.Empty; 
        }
    }
}